package com.suns.demo;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

public class DemoProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("suns-producer-01");
        producer.setNamesrvAddr("localhost:9876");
        producer.start();

        Message message = null;

        for (int i = 0; i < 10000000; i++) {
            message = new Message("suns-topic-01", ("hello suns demo-" + i).getBytes());
            SendResult result = producer.send(message);
            System.out.println(result);
        }

        producer.shutdown();
    }
}
